<?php

class Login_Model extends CI_Model {

	public function __construct(){
		parent::__construct();
	}
	
	var $_table_name = 'users';
	
	public function check_user($username, $password) {
		$this->db->select($this->_table_name.'.*, name');
		$this->db->where('username', $username);
		$this->db->where('password', md5($password));
		$this->db->join('actors','actors.id = '. $this->_table_name . '.actor_id');
		$rs = $this->db->get($this->_table_name);
		
		//echo $this->db->last_query();
		return $rs->row();
	}
	
	public function get_person_id($id, $table_target){
		$this->db->select('id');
		$this->db->where('user_id',$id);
		$rs = $this->db->get($table_target);
		//echo $this->db->last_query();
		return $rs->row();
	}

}
